package com.qiujie.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qiujie.annotation.ExcelColumn;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;


@Data
@TableName("sys_annual_leave")
@AllArgsConstructor
@Setter
@Getter
public class AnnualLeave {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ExcelColumn("员工id")
    @ApiModelProperty("员工id")
    @TableField("staff_id")
    private Integer staffId;

    @ExcelColumn("年份")
    @ApiModelProperty("年份")
    @TableField("year")
    private Integer year;

    @ExcelColumn("总天数")
    @ApiModelProperty("总天数")
    @TableField("total_days")
    private Integer totalDays;

    @ExcelColumn("已用天数")
    @ApiModelProperty("已用天数")
    @TableField("used_days")
    private Integer usedDays;

    // 计算剩余天数（非数据库字段）
    @TableField(exist = false)
    private Integer remainingDays;


    public AnnualLeave(Integer staffId, Integer year,
                       Integer totalDays, Integer usedDays) {
        this.staffId = staffId;
        this.year = year;
        this.totalDays = totalDays;
        this.usedDays = usedDays;
    }

    // 添加包含所有表字段的构造器
    public AnnualLeave(Integer id, Integer staffId, Integer year,
                       Integer totalDays, Integer usedDays) {
        this.id = id;
        this.staffId = staffId;
        this.year = year;
        this.totalDays = totalDays;
        this.usedDays = usedDays;
    }

}

